import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Test11 {
    public static void main(String[] args) {
        ArrayList<String> manlist=new ArrayList<>();
        ArrayList<String> womanlist=new ArrayList<>();
        Collections.addAll(manlist,"蔡坤坤,24","叶翰咸,23","刘不甜,22","吴笠,24","谷嘉,30","肖梁梁,27");
        Collections.addAll(womanlist,"赵小印,35","杨颖,36","高圆圆,43","张甜甜,31","刘子涵，35","杨幂,33");
        Stream<String> man=manlist.stream().limit(2);
               /* .forEach(new Consumer<String>(){
                @Override
                    public void accept(String s){
                    System.out.println(s);
                }
                });*/
       Stream<String> woman= womanlist.stream().filter(new Predicate<String>(){
            @Override
            public boolean test(String s){
                return s.split(",")[0].toString().startsWith("杨");
            }

        })
                .skip(1);
        /* Stream.concat(man,woman).map(new Function<String,Actor>(){
           @Override
                public Actor apply(String s){
               String name=s.split(",")[0];
               int age=Integer.parseInt(s.split(",")[1]);
               return new Actor(name,age);
        }
       });*/
        List<Actor> list=Stream.concat(man,woman).map(s-> new Actor(s.split(",")[0],Integer.parseInt(s.split(",")[1])))
                                .collect(Collectors.toList());
       System.out.println(list);
    }
}
